package com.briup.estore.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.util.DigestUtils;

/**
 * @author adam
 * @date 2023/3/31
 */
@Data
@TableName("t_user")
public class UserEntity {
    @TableId
    private Long id;
    private String address;
    private String eMail;
    private boolean isLock;
    private String loginName;
    private String realName;
    private String passwordMd5;
    private String phone;
    private String gender;
    private String birth;
    private String img;

    public void setPasswordMd5(String passwordMd5) {

        if (passwordMd5.length() != 32) {
            this.passwordMd5 = DigestUtils.md5DigestAsHex(passwordMd5.getBytes());
        }else{
            this.passwordMd5=passwordMd5;

        }
    }
}
